<!-- gofurry-cloud custom -->

<!-- 修改样式 -->
<style>
  /* 隐藏管理按钮 */
  .hope-c-PJLV-ihQbspH-css {
    display: none;
  }

  /* 站点公告的样式 */
  .hope-ui-light .hope-c-PJLV-ikJQsXT-css {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(0) !important;
  }

  .hope-ui-dark .hope-c-PJLV-ikJQsXT-css {
    background: rgb(32, 36, 37) !important;
    backdrop-filter: blur(0) !important;
  }

  .hope-c-PJLV-ikbgtxB-css {
    background: rgba(32, 36, 37, 0.5) !important;
  }
</style>

<!-- 锁定暗色风格 -->
<script>
  document.body.className = "hope-ui-dark";

  // 阻止修改 body.class
  Object.defineProperty(document.body, "className", {
    get() {
      return "hope-ui-dark";
    },
    set(newClass) {
      console.warn("禁止修改 body 的 class，已锁定为 hope-ui-dark");
    },
  });

  const originalAdd = document.body.classList.add;
  const originalRemove = document.body.classList.remove;
  const originalToggle = document.body.classList.toggle;

  document.body.classList.add = function (...args) {
    console.warn("禁止添加 body 的 class，已锁定为 hope-ui-dark");
  };
  document.body.classList.remove = function (...args) {
    if (args.includes("hope-ui-dark")) {
      console.warn("禁止移除 hope-ui-dark，body class 已锁定");
    }
  };
  document.body.classList.toggle = function (...args) {
    if (args.includes("hope-ui-dark")) {
      console.warn("禁止切换 hope-ui-dark，body class 已锁定");
      return true;
    }
  };
</script>

<!-- 爪印点击特效 -->
<script type="text/javascript">
  !(function (e, t, a) {
    // 动画帧函数：更新所有爪印的状态并移除失效的元素
    function r() {
      for (var e = 0; e < s.length; e++)
        if (s[e].alpha <= 0) {
          // 从页面中移除元素并从数组中删除
          t.body.removeChild(s[e].el);
          s.splice(e, 1);
        } else {
          // 更新爪印属性：上移、放大、透明度降低
          s[e].y--;
          s[e].scale += 0.003;
          s[e].alpha -= 0.01;
          // 应用样式到DOM元素
          s[e].el.style.cssText =
            "left:" +
            s[e].x +
            "px;top:" +
            s[e].y +
            "px;opacity:" +
            s[e].alpha +
            ";transform:scale(" +
            s[e].scale +
            "," +
            s[e].scale +
            ");z-index:99999";
        }
      // 请求下一帧动画
      requestAnimationFrame(r);
    }

    // 重写点击事件：保留原有点击事件并添加爪印效果
    function n() {
      // 保存原有的onclick事件
      var t = "function" == typeof e.onclick && e.onclick;
      // 重写点击事件
      e.onclick = function (e) {
        // 执行原有的点击事件
        t && t();
        // 触发爪印生成
        o(e);
      };
    }

    // 创建爪印元素并添加到页面
    function o(e) {
      // 创建div元素作为爪印容器
      var a = t.createElement("div");
      a.className = "paw-print";

      // 创建掌垫
      var pad = t.createElement("div");
      pad.className = "paw-pad";
      a.appendChild(pad);

      // 创建四个爪趾
      for (var i = 0; i < 4; i++) {
        var toe = t.createElement("div");
        toe.className = "paw-toe";
        a.appendChild(toe);
      }

      // 生成并应用随机颜色
      var color = c();
      // 直接设置掌垫和爪趾的颜色
      pad.style.background = color;
      var toes = a.getElementsByClassName("paw-toe");
      for (var j = 0; j < toes.length; j++) {
        toes[j].style.background = color;
      }

      // 将新爪印添加到数组
      s.push({
        el: a,
        x: e.clientX - 25, // X坐标（居中偏移）
        y: e.clientY - 25, // Y坐标（居中偏移）
        scale: 1,
        alpha: 1,
        color: color,
      });

      // 将爪印添加到页面
      t.body.appendChild(a);
    }

    // 动态添加样式到页面
    function i(e) {
      var a = t.createElement("style");
      a.type = "text/css";
      try {
        a.appendChild(t.createTextNode(e));
      } catch (t) {
        // 兼容IE浏览器
        a.styleSheet.cssText = e;
      }
      // 将样式添加到head标签
      t.getElementsByTagName("head")[0].appendChild(a);
    }

    // 生成随机RGB颜色
    function c() {
      // var r = ~~(20 + Math.random() * 80); // 红通道 20-100
      // var g = ~~(10 + Math.random() * 60); // 绿通道 10-70
      // var b = ~~(0 + Math.random() * 40); // 蓝通道 0-40
      // return "rgb(" + r + "," + g + "," + b + ")";
      return "rgb(255, 255, 255)"; // 白色
    }

    // 存储所有爪印元素的数组
    var s = [];
    // 兼容各浏览器的requestAnimationFrame
    e.requestAnimationFrame =
      e.requestAnimationFrame ||
      e.webkitRequestAnimationFrame ||
      e.mozRequestAnimationFrame ||
      e.oRequestAnimationFrame ||
      e.msRequestAnimationFrame ||
      function (e) {
        setTimeout(e, 1e3 / 60);
      };
    // 添加爪印的CSS样式（移除了currentColor依赖）
    i(`
      .paw-print {
        position: fixed;
        width: 30px;
        height: 30px;
      }
      
      /* 掌垫样式 */
      .paw-pad {
        position: absolute;
        bottom: 0;
        left: 10px;
        width: 20px;
        height: 15px;
        border-radius: 50% 50% 40% 40%;
      }
      
      /* 爪趾样式 */
      .paw-toe {
        position: absolute;
        width: 9px;
        height: 9px;
        border-radius: 50%;
      }
      
      /* 定位四个爪趾 */
      .paw-toe:nth-child(2) { top: 7px; left: 5px; }
      .paw-toe:nth-child(3) { top: 4px; left: 14px; }
      .paw-toe:nth-child(4) { top: 4px; left: 23px; }
      .paw-toe:nth-child(5) { top: 10px; left: 30px; }
    `);
    // 初始化点击事件
    n();
    // 启动动画循环
    r();
  })(window, document);
</script>

<!-- 覆盖云盘默认标题 切页面改变标题 -->
<script>
  const defaultTitle = "GoFurry-Cloud ฅ^•ﻌ•^ฅ"; // 默认标题
  const hiddenTitle = "GoFurry-Cloud (=🝦 ﻌ 🝦=)"; // 页面隐藏时的标题
  let titleTime;

  // 覆盖云盘默认标题
  document.title = defaultTitle;

  // 标题变化监听器, 防止云盘自动覆盖
  const titleElem = document.querySelector("title");
  if (titleElem) {
    new MutationObserver((mutations) => {
      // 标题不是预期标题时进行修改
      const currentTitle = document.title;
      if (
        currentTitle !== defaultTitle &&
        currentTitle !== hiddenTitle &&
        currentTitle !== OriginTitle
      ) {
        document.title = defaultTitle;
      }
    }).observe(titleElem, { characterData: true, childList: true });
  }

  // 切页面变化标题
  const OriginTitle = defaultTitle; // 默认标题
  document.addEventListener("visibilitychange", function () {
    if (document.hidden) {
      // 切页面的标题
      document.title = hiddenTitle;
      clearTimeout(titleTime);
    } else {
      // 当前页面的标题
      document.title = defaultTitle;
      // 2秒后保持默认标题
      titleTime = setTimeout(() => {
        document.title = defaultTitle;
      }, 2000);
    }
  });
</script>

<!-- 延迟加载 -->
<div id="customize" style="display: none">
  <div>
    <br />
    <center>
      <div style="line-height: 20px; font-size: 9pt; font-weight: bold">
        <span>
          "
          <span
            style="color: rgb(154, 216, 166); font-weight: bold"
            id="gofurrySaying"
          >
            <a href="#" id="gofurrySaying_text"> 你的恩情, 狼不会忘记. </a>
          </span>
          "
        </span>
      </div>

      <!-- 底部链接 -->
      <div style="font-size: 13px; font-weight: bold">
        <span>
          <a href="mailto:2660621624@qq.com" target="_blank">
            <i style="color: #409eff" aria-hidden="true">✉️</i>
            联系站长 |
          </a>
        </span>
        <span>
          <a href="https://www.go-furry.com" target="_blank">
            <i style="color: #409eff" aria-hidden="true"> </i>
            GoFurry |
          </a>
        </span>
        <!--后台入口-->
        <span>
          <a href="/@manage" target="_blank">
            <i style="color: #409eff" aria-hidden="true"> </i>
            管理 |
          </a>
        </span>
        <!-- 由 OpenList 开源云盘驱动，软件版权属于 OpenList-->
        <span>
          <a href="https://github.com/OpenListTeam/OpenList" target="_blank">
            <i style="color: #409eff" aria-hidden="true"> </i>
            Openlist
          </a>
        </span>
        <br />
        <br />
        <!--添加备案信息-->
        <span>
          <a
            class="nav-link"
            href="https://beian.miit.gov.cn/#/Integrated/index"
            target="_blank"
          >
            <i
              class="fa-solid fa-shield-check"
              style="color: #409eff"
              aria-hidden="true"
            >
            </i>
            蜀ICP备2025158691号-1
          </a>
        </span>
      </div>
    </center>
    <br />
  </div>

  <!--一言API-->
  <!-- <script
    src="https://v1.hitokoto.cn/?encode=js&select=%23hitokoto"
    defer
  ></script> -->
  <!-- GoFurry-CLoud-Service 本地API -->
  <script
    src="https://www.gofurry-cloud.com:9998/gf_cloud/api/ol/util/getSaying"
    defer
  ></script>
  <!--延迟加载范围到这里结束-->
</div>

<!-- 延迟加载JS -->
<script>
  let interval = setInterval(() => {
    if (document.querySelector(".footer")) {
      document.querySelector("#customize").style.display = "";
      clearInterval(interval);
    }
  }, 200);
</script>

<!-- 网站运行时间显示模块 -->
<div
  class="uptime-container"
  style="
    position: fixed;
    left: 10px;
    bottom: 10px;
    border-radius: 4px;
    font-size: 14px;
    color: rgb(154, 216, 166);
    z-index: 1000;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
  "
>
  <!-- 可点击图标 -->
  <span
    class="uptime-icon"
    style="font-size: 20px; padding: 8px; display: inline-block"
    >⏱️</span
  >

  <div
    class="uptime-text"
    style="
      overflow: hidden;
      max-width: 0;
      transition: max-width 0.3s ease;
      white-space: nowrap;
    "
  >
    <span id="uptimeFullText">载入中...</span>
  </div>
</div>

<script>
  const siteLaunchTime = new Date("2025-08-20T00:00:00");
  let currentTime = new Date();
  let isExpanded = false;

  const container = document.querySelector(".uptime-container");
  const textContainer = document.querySelector(".uptime-text");
  const uptimeFullText = document.getElementById("uptimeFullText");

  function isPhone() {
    return window.innerWidth < 630;
  }

  // 检查是否为移动设备尺寸
  function isMobile() {
    return window.innerWidth < 850;
  }

  // 时分秒补零
  function padZero(num) {
    return String(num).padStart(2, "0");
  }

  // 更新运行时间
  function updateSiteUptime() {
    currentTime.setTime(currentTime.getTime() + 250);
    const timeDiff = currentTime - siteLaunchTime;

    const days = Math.floor(timeDiff / 1000 / 60 / 60 / 24);
    const hours = padZero(Math.floor((timeDiff / 1000 / 60 / 60) % 24));
    const minutes = padZero(Math.floor((timeDiff / 1000 / 60) % 60));
    const seconds = padZero(Math.round((timeDiff / 1000) % 60));

    // 超小屏幕
    if (isPhone() && isMobile && isExpanded) {
      uptimeFullText.textContent = `${days}天🐲`;
    }
    // 小屏幕
    else if (isMobile() && isExpanded) {
      uptimeFullText.textContent = `本站已稳定运行${days}天🐲`;
    }
    // 正常屏幕
    else if (!isMobile() && isExpanded) {
      uptimeFullText.textContent = `本站已稳定运行${days}天${hours}小时${minutes}分钟${seconds}秒🐲`;
    }
    // 未展开
    else {
      uptimeFullText.textContent = "";
    }
  }

  // 点击切换展开/收起状态
  container.addEventListener("click", () => {
    isExpanded = !isExpanded;

    if (isExpanded) {
      textContainer.style.maxWidth = isMobile() ? "200px" : "500px";
      container.style.paddingRight = "12px";
    } else {
      textContainer.style.maxWidth = "0";
      container.style.paddingRight = "0";
    }

    updateSiteUptime();
  });

  // 监听窗口大小变化，自动调整显示
  window.addEventListener("resize", () => {
    if (isExpanded) {
      updateSiteUptime();
      textContainer.style.maxWidth = isMobile() ? "200px" : "500px";
    }
  });

  // 初始化
  updateSiteUptime();
  setInterval(updateSiteUptime, 250);
</script>
